package org.geekbang.projects.config.source;

import org.eclipse.microprofile.config.spi.ConfigSource;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;

/**
* 配置资源集  
* @author : KangNing Hu
*/
public final class ConfigSources extends ArrayList<ConfigSource> {

	private static Comparator<ConfigSource> configSourceComparator = (o1,o2) ->Integer.compare(o2.getOrdinal(), o1.getOrdinal());



	public void add(ConfigSource... configSources){
		this.addAll(Arrays.asList(configSources));
	}


	/**
	 * 排序
	 */
	public ConfigSources sort(){
		this.sort(configSourceComparator);
		return this;
	}



}
